package com.xuge.ojwangcodesandbox.manage;

import com.xuge.ojwangcodesandbox.services.CodeSandBox;
import com.xuge.ojwangcodesandbox.services.c.CNativeCodeSandbox;
import com.xuge.ojwangcodesandbox.services.cpp.CppNativeCodeSandbox;
import com.xuge.ojwangcodesandbox.services.java.JavaNativeCodeSandbox;
import com.xuge.ojwangcodesandbox.services.python3.PythonNativeCodeSandbox;
import org.springframework.stereotype.Service;

/**
 *
 * 判题管理，简化判题服务
 */
@Service
public class SandboxManager {


    public static CodeSandBox getSandBox(String language) {
        switch (language) {
            case "java":
                return new JavaNativeCodeSandbox();
            case "python":
                return new PythonNativeCodeSandbox();
            case "c":
                return new CNativeCodeSandbox();
            case "cpp":
                return new CppNativeCodeSandbox();
            default:
                throw new RuntimeException("不支持该语言");
        }

    }
}
